# -- 随机创建一注彩票
import random
list_ticket = []
while len(list_ticket) < 8:
     ticket = random.randint(1, 33)
     if ticket not in list_ticket:
         list_ticket.append(ticket)

         print(list_ticket)

# -- 在终端中录入（购买）一注彩票
list_ticket = []
while len(list_ticket) < 8:
    ticket = int(input("请输入第%d个号码：" % (len(list_ticket) + 1)))
    if ticket < 1 or ticket > 33:
        print("超过范围")
    elif ticket in list_ticket:
        print("号码已经存在")
    else:
        list_ticket.append(ticket)

print(list_ticket)